// import { Component } from 'react'
import { View, Text, Swiper, SwiperItem, Image } from '@tarojs/components'
import Taro from '@tarojs/taro'
import { useState, useEffect } from 'react'
import { indexTaskList } from '@/api/index'
import '/src/assets/icon/iconFront/iconfont.css'
import './index.scss'


export default function Index() {
    const [list, setList] = useState([])
    useEffect(() => {
        (async () => {
            const result = await indexTaskList()
            console.log('result', result, list);
            setList(result)
        })()
    }, [])
    const clickPlanItem = () => {
        Taro.navigateTo({
            url: '/pages/detail/index'
        })
    }
    return (
        <View className='w-100 h-100 d-f fd-c jc-c at-c index'>
            <View className='plan-list'>
                {list.map(item => (
                    <View onclick={clickPlanItem} key={item.id} className='d-f plan-item lh-n'>
                        <Image className='plan-item-img' src={item.imgUrl} />
                        <View className='plan-describe df fd-c'>
                            <View className='plan-title'> {item.title}</View>
                            <View className='plan-time'>
                                <Text className='iconfont icon-shijianbeifen'></Text>
                                <Text> {item.lastTime}</Text>
                            </View>
                        </View>
                        <Text className='iconfont icon-gengduo more'></Text>
                    </View>
                ))}
            </View>
        </View >
    )
}
